110 NT=1:FOR EZ=E1 TO E2:RN=RND:IF RN<XN THEN EX(NT)=EZ:NT=NT+1:IF NT>NM THEN 120
115 NEXT:IF NT<=NM THEN 110
120 TB=6:IF E2>10000 THEN TB=10
125 GOSUB 215:T=1:FOR Z=1 TO NM:PRINT #1,TAB(T);EX(Z);:T=T+TB:IF T>PMAX THEN T=1
130 NEXT:PRINT #1,:GOTO 265
135 PRINT TAB(24);"ASSIGN SUBJECTS TO TWO GROUPS":PRINT TAB(24);STRING$(29,205)
140 LOCATE 4,2:INPUT "Will subjects enter the study over a period of time longer than 1 month? ",A$:PRINT:AF=0
145 IF A$="y" OR A$="Y" THEN AF=1:PRINT "Then it is preferable to randomize SUBSETS independently to avoid seasonal bias":PRINT TAB(15);"and to asssure equal numbers of cases and controls":PRINT TAB(23);"should the study terminate early.":PRINT
150 D1="How many subjects ":IF AF=1 THEN PRINT TAB(5);D1;:INPUT "are expected to enter the study each month? ",NM ELSE PRINT TAB(13);D1;:INPUT "(total) will be in the study? ",NM
255 FOR Z=1 TO NM:PRINT #1,TAB(10);Z;:RN=RND:PRINT #1,TAB(PMAX/3+2);:IF RN<0.5 THEN PRINT #1,D1;TAB(PMAX*2/3+2);D2 ELSE PRINT #1,D2;TAB(PMAX*2/3+2);D1
260 NEXT
265 CLOSE #1:LOCATE 25,15:INPUT;"Do you want to perform another randomization? ",A$:IF A$="y" OR A$="Y" THEN 20
270 LOCATE 23,1:END
5000 BEEP:IF ERR<>53 AND ERR<>71 THEN 5010 ELSE LOCATE 10,10:PRINT "Please place EPISTAT in drive A: (or other default).":PRINT TAB(25);"Press any key to continue:"